<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>digichef.profiles.views</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="digichef-module.html">Package&nbsp;digichef</a> ::
        <a href="digichef.profiles-module.html">Package&nbsp;profiles</a> ::
        Module&nbsp;views
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="digichef.profiles.views-module.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<!-- ==================== MODULE DESCRIPTION ==================== -->
<h1 class="epydoc">Module views</h1><p class="nomargin-top"><span class="codelink"><a href="digichef.profiles.views-pysrc.html">source&nbsp;code</a></span></p>
<pre class="literalblock">

Views for creating, editing and viewing site-specific user profiles.

</pre>

<!-- ==================== FUNCTIONS ==================== -->
<a name="section-Functions"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Functions</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Functions"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="digichef.profiles.views-module.html#create_profile" class="summary-sig-name">create_profile</a>(<span class="summary-sig-arg">request</span>,
        <span class="summary-sig-arg">form_class</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">success_url</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">template_name</span>=<span class="summary-sig-default">'profiles/create_profile.html'</span>,
        <span class="summary-sig-arg">extra_context</span>=<span class="summary-sig-default">None</span>)</span><br />
      Create a profile for the current user, if one doesn't already
exist.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="digichef.profiles.views-pysrc.html#create_profile">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="digichef.profiles.views-module.html#edit_profile" class="summary-sig-name">edit_profile</a>(<span class="summary-sig-arg">request</span>,
        <span class="summary-sig-arg">form_class</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">success_url</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">template_name</span>=<span class="summary-sig-default">'profiles/edit_profile.html'</span>,
        <span class="summary-sig-arg">extra_context</span>=<span class="summary-sig-default">None</span>)</span><br />
      Edit the current user's profile.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="digichef.profiles.views-pysrc.html#edit_profile">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="digichef.profiles.views-module.html#profile_detail" class="summary-sig-name">profile_detail</a>(<span class="summary-sig-arg">request</span>,
        <span class="summary-sig-arg">username</span>,
        <span class="summary-sig-arg">public_profile_field</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">template_name</span>=<span class="summary-sig-default">'profiles/profile_detail.html'</span>,
        <span class="summary-sig-arg">extra_context</span>=<span class="summary-sig-default">None</span>)</span><br />
      Detail view of a user's profile.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="digichef.profiles.views-pysrc.html#profile_detail">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="digichef.profiles.views-module.html#profile_list" class="summary-sig-name">profile_list</a>(<span class="summary-sig-arg">request</span>,
        <span class="summary-sig-arg">public_profile_field</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">template_name</span>=<span class="summary-sig-default">'profiles/profile_list.html'</span>,
        <span class="summary-sig-arg">**kwargs</span>)</span><br />
      A list of user profiles.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="digichef.profiles.views-pysrc.html#profile_list">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
</table>
<!-- ==================== FUNCTION DETAILS ==================== -->
<a name="section-FunctionDetails"></a>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Function Details</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-FunctionDetails"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
</table>
<a name="create_profile"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">create_profile</span>(<span class="sig-arg">request</span>,
        <span class="sig-arg">form_class</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">success_url</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">template_name</span>=<span class="sig-default">'profiles/create_profile.html'</span>,
        <span class="sig-arg">extra_context</span>=<span class="sig-default">None</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="digichef.profiles.views-pysrc.html#create_profile">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

Create a profile for the current user, if one doesn't already
exist.

If the user already has a profile, as determined by
``request.user.get_profile()``, a redirect will be issued to the
:view:`profiles.views.edit_profile` view. If no profile model has
been specified in the ``AUTH_PROFILE_MODULE`` setting,
``django.contrib.auth.models.SiteProfileNotAvailable`` will be
raised.

**Optional arguments:**

``extra_context``
    A dictionary of variables to add to the template context. Any
    callable object in this dictionary will be called to produce
    the end result which appears in the context.

``form_class``
    The form class to use for validating and creating the user
    profile. This form class must define a method named
    ``save()``, implementing the same argument signature as the
    ``save()`` method of a standard Django ``ModelForm`` (this
    view will call ``save(commit=False)`` to obtain the profile
    object, and fill in the user before the final save). If the
    profile object includes many-to-many relations, the convention
    established by ``ModelForm`` of using a method named
    ``save_m2m()`` will be used, and so your form class should
    also define this method.
    
    If this argument is not supplied, this view will use a
    ``ModelForm`` automatically generated from the model specified
    by ``AUTH_PROFILE_MODULE``.

``success_url``
    The URL to redirect to after successful profile creation. If
    this argument is not supplied, this will default to the URL of
    :view:`profiles.views.profile_detail` for the newly-created
    profile object.

``template_name``
    The template to use when displaying the profile-creation
    form. If not supplied, this will default to
    :template:`profiles/create_profile.html`.

**Context:**

``form``
    The profile-creation form.

**Template:**

``template_name`` keyword argument, or
:template:`profiles/create_profile.html`.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="edit_profile"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">edit_profile</span>(<span class="sig-arg">request</span>,
        <span class="sig-arg">form_class</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">success_url</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">template_name</span>=<span class="sig-default">'profiles/edit_profile.html'</span>,
        <span class="sig-arg">extra_context</span>=<span class="sig-default">None</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="digichef.profiles.views-pysrc.html#edit_profile">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

Edit the current user's profile.

If the user does not already have a profile (as determined by
``User.get_profile()``), a redirect will be issued to the
:view:`profiles.views.create_profile` view; if no profile model
has been specified in the ``AUTH_PROFILE_MODULE`` setting,
``django.contrib.auth.models.SiteProfileNotAvailable`` will be
raised.

**Optional arguments:**

``extra_context``
    A dictionary of variables to add to the template context. Any
    callable object in this dictionary will be called to produce
    the end result which appears in the context.

``form_class``
    The form class to use for validating and editing the user
    profile. This form class must operate similarly to a standard
    Django ``ModelForm`` in that it must accept an instance of the
    object to be edited as the keyword argument ``instance`` to
    its constructor, and it must implement a method named
    ``save()`` which will save the updates to the object. If this
    argument is not specified, this view will use a ``ModelForm``
    generated from the model specified in the
    ``AUTH_PROFILE_MODULE`` setting.

``success_url``
    The URL to redirect to following a successful edit. If not
    specified, this will default to the URL of
    :view:`profiles.views.profile_detail` for the profile object
    being edited.

``template_name``
    The template to use when displaying the profile-editing
    form. If not specified, this will default to
    :template:`profiles/edit_profile.html`.

**Context:**

``form``
    The form for editing the profile.
    
``profile``
     The user's current profile.

**Template:**

``template_name`` keyword argument or
:template:`profiles/edit_profile.html`.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="profile_detail"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">profile_detail</span>(<span class="sig-arg">request</span>,
        <span class="sig-arg">username</span>,
        <span class="sig-arg">public_profile_field</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">template_name</span>=<span class="sig-default">'profiles/profile_detail.html'</span>,
        <span class="sig-arg">extra_context</span>=<span class="sig-default">None</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="digichef.profiles.views-pysrc.html#profile_detail">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

Detail view of a user's profile.

If no profile model has been specified in the
``AUTH_PROFILE_MODULE`` setting,
``django.contrib.auth.models.SiteProfileNotAvailable`` will be
raised.

If the user has not yet created a profile, ``Http404`` will be
raised.

**Required arguments:**

``username``
    The username of the user whose profile is being displayed.

**Optional arguments:**

``extra_context``
    A dictionary of variables to add to the template context. Any
    callable object in this dictionary will be called to produce
    the end result which appears in the context.

``public_profile_field``
    The name of a ``BooleanField`` on the profile model; if the
    value of that field on the user's profile is ``False``, the
    ``profile`` variable in the template will be ``None``. Use
    this feature to allow users to mark their profiles as not
    being publicly viewable.
    
    If this argument is not specified, it will be assumed that all
    users' profiles are publicly viewable.

``template_name``
    The name of the template to use for displaying the profile. If
    not specified, this will default to
    :template:`profiles/profile_detail.html`.

**Context:**

``profile``
    The user's profile, or ``None`` if the user's profile is not
    publicly viewable (see the description of
    ``public_profile_field`` above).

**Template:**

``template_name`` keyword argument or
:template:`profiles/profile_detail.html`.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="profile_list"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">profile_list</span>(<span class="sig-arg">request</span>,
        <span class="sig-arg">public_profile_field</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">template_name</span>=<span class="sig-default">'profiles/profile_list.html'</span>,
        <span class="sig-arg">**kwargs</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="digichef.profiles.views-pysrc.html#profile_list">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <pre class="literalblock">

A list of user profiles.

If no profile model has been specified in the
``AUTH_PROFILE_MODULE`` setting,
``django.contrib.auth.models.SiteProfileNotAvailable`` will be
raised.

**Optional arguments:**

``public_profile_field``
    The name of a ``BooleanField`` on the profile model; if the
    value of that field on a user's profile is ``False``, that
    profile will be excluded from the list. Use this feature to
    allow users to mark their profiles as not being publicly
    viewable.
    
    If this argument is not specified, it will be assumed that all
    users' profiles are publicly viewable.

``template_name``
    The name of the template to use for displaying the profiles. If
    not specified, this will default to
    :template:`profiles/profile_list.html`.

Additionally, all arguments accepted by the
:view:`django.views.generic.list_detail.object_list` generic view
will be accepted here, and applied in the same fashion, with one
exception: ``queryset`` will always be the ``QuerySet`` of the
model specified by the ``AUTH_PROFILE_MODULE`` setting, optionally
filtered to remove non-publicly-viewable proiles.

**Context:**

Same as the :view:`django.views.generic.list_detail.object_list`
generic view.

**Template:**

``template_name`` keyword argument or
:template:`profiles/profile_list.html`.

</pre>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

      <th class="navbar" width="100%"></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1 on Thu Apr  1 02:28:18 2010
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
